Environment

abstract class Environment(defaultExport: Boolean) : MutableDelegatable, ReadWriteProperty<Any?, String?>

Environment variable accessors, that by default exports if defaultExport is true.

Can be delegated from. Delegating from Environment treats the input as optional.

Constructors

Environment
Link copied to clipboard
fun Environment(defaultExport: Boolean)

Functions

contains
Link copied to clipboard
open operator fun contains(name: String): Boolean
export
Link copied to clipboard
fun export(name: String)
Export name with it's current value.
fun export(name: String, value: String)
Export name with value.
get
Link copied to clipboard
operator fun get(name: String): String?
Get name from the environment, or null if it is not present.
getOptional
Link copied to clipboard
open override fun getOptional(name: String): String?
Get name from the environment, or null if it is not present.
getOrElse
Link copied to clipboard
fun getOrElse(name: String, default: () -> String): String
Get the input passed for name, or default if it was not passed.
getOrPut
Link copied to clipboard
fun getOrPut(name: String, default: () -> String): String
Get name, or set default for name and return it.
fun getOrPut(name: String, export: Boolean, default: () -> String): String
Get name from the environment, or set default for name and return it.
getRequired
Link copied to clipboard
open override fun getRequired(name: String): String
Get name from the environment, or throw if it is not present.
getValue
Link copied to clipboard
open operator override fun getValue(thisRef: Any?, property: KProperty<*>): String?
A delegate based on the property name, for an optional state.
invoke
Link copied to clipboard
operator fun invoke(name: String): ReadWriteProperty<Any?, String?>
Delegate for name.
remove
Link copied to clipboard
open override fun remove(name: String)
Remove name from the environment.
required
Link copied to clipboard
fun required(name: String): ReadWriteProperty<Any?, String>
Optional delegate for name.
set
Link copied to clipboard
open operator override fun set(name: String, value: String)
Set name in the environment, following the default export setting for the Environment.
operator fun set(name: String, value: String?)
Set name in the environment, following the default export setting for the Environment.
operator fun set(name: String, export: Boolean, value: String?)
Set name in the environment, exporting according to export.
setValue
Link copied to clipboard
open operator override fun setValue(thisRef: Any?, property: KProperty<*>, value: String?)
A delegate based on the property name, for an optional state.
withDefault
Link copied to clipboard
fun withDefault(default: () -> String): ReadOnlyProperty<Any?, String>
Get an optional delegate with a default value.
fun withDefault(name: String, default: () -> String): ReadOnlyProperty<Any?, String>
Get an optional delegate with a default value for name.

Properties

required
Link copied to clipboard
val required: ReadWriteProperty<Any?, String>
Optional delegate.

Inheritors

exportEnv
Link copied to clipboard
env
Link copied to clipboard

Sources

js source
Link copied to clipboard